package com.lzw.blog.admin.controller;

import com.lzw.blog.admin.model.params.PageParam;
import com.lzw.blog.admin.pojo.Tag;
import com.lzw.blog.admin.service.TagService;
import com.lzw.blog.admin.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("admin/tag")
public class TagController {

    @Autowired
    private TagService tagService;

    @PostMapping("tagList")
    public Result listTag(@RequestBody PageParam pageParam) {
        return tagService.listTag(pageParam);
    }

    @GetMapping("delete/{id}")
    public Result deleteTag(@PathVariable("id") Long id) {
        return tagService.delete(id);
    }

    @PostMapping("update")
    public Result updateTag(@RequestBody Tag tag) {
        return tagService.update(tag);
    }

    @PostMapping("add")
    public Result addTag(@RequestBody Tag tag) {
        return tagService.add(tag);
    }
}
